package com.woniuxy.company5.service.impl;

import com.woniuxy.company5.dto.LMacInformationDto;
import com.woniuxy.company5.dto.MacInfoDto;
import com.woniuxy.company5.dto.MacInformationDto;
import com.woniuxy.company5.entity.MacInformation;
import com.woniuxy.company5.mapper.MacInformationMapper;
import com.woniuxy.company5.service.MacInformationService;
import com.woniuxy.company5.vo.MacInformationVo;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;


@Service
public class MacInformationServiceImpl implements MacInformationService {
    @Resource
    private MacInformationMapper macInformationMapper;


    @Override
    public List<MacInformationVo> selAllSheBei() {
        return macInformationMapper.selAllSheBei();
    }

    @Override
    public List<MacInformationVo> selAllSheBei(MacInfoDto macInfoDto) {
        return macInformationMapper.selAllSheBei(macInfoDto);
    }

    @Override
    public MacInformationVo selOneById(Long id) {
        return macInformationMapper.sleOneMacById(id) ;
    }

    @Override
    public int deleteByPrimaryKey(Long id) {
        return 0;
    }

    @Override
    public int insertSelectivel(LMacInformationDto macInformationDto, int iid) {
        MacInformation macInformation = new MacInformation();
        macInformation.setBrand(macInformationDto.getBrand());;
        macInformation.setModel(macInformationDto.getModel());;
        macInformation.setCapacity(macInformationDto.getCapacity());;//容量
        macInformation.setSerialNum(macInformationDto.getSerialNum());;//序列号
        macInformation.setState(macInformationDto.getState());;//设备状态。正常、损坏、寿命快到期
        macInformation.setDate(macInformationDto.getDate());;//生产日期
        macInformation.setLift(macInformationDto.getLift());;//设备寿命。默认365天
        macInformation.setTypeId(macInformationDto.getTypeId());;//设备类型
        macInformation.setInterfaceId(macInformationDto.getInterfaceId());;//设备接口类型
        macInformation.setWho(macInformationDto.getWho());;//客户
        macInformation.setImgId(String.valueOf(iid));

        macInformationMapper.insertSelective(macInformation);
        return macInformation.getId();
    }

    @Override
    public int insert(MacInformation record) {
        return 0;
    }

    @Override
    public int insertSelective(MacInformation record) {
        return macInformationMapper.insertSelective(record);
    }

    @Override
    public MacInformation selectByPrimaryKey(Long id) {
        return null;
    }

    @Override
    public int updateByPrimaryKeySelective(MacInformation record) {
        return 0;
    }

    @Override
    public int updateByPrimaryKey(MacInformation record) {
        return 0;
    }
}
